<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>认证服务器端登录页面</title>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/signin.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script type="text/javascript" th:inline="javascript">
		function refreshCode() {
			var o = document.getElementById("captcha");
			var url = "captcha.jpg";
			o.src = url;
		}
		function doLogin(){
			$.post([[@{/doLogin}]], $("#loginForm").serialize(), function(data){
				if(data.code == 0){
					window.location.href = data.msg;
				}else{
					alert(data.msg);
					refreshCode();
				}
			})
		}
	</script>
  </head>

  <body>
    <div class="container form-margin-top">
      <form class="form-signin" id="loginForm" method="post">
        <h2 class="form-signin-heading" align="center">认证中心统一登录平台</h2>
        <input type="text" name="username" class="form-control form-margin-top" placeholder="账号" required autofocus>
        <input type="password" name="password" class="form-control" placeholder="密码" required>
        <div><input type="text" name="captcha" class="form-control" placeholder="验证码" required style="width: 49%;display: inline;">
        <img class="img-responsive pull-right" id="captcha"
								onclick="refreshCode(this);" src="captcha.jpg" style="cursor:pointer;width: 49%;display: inline;height: 44px;" />
		</div>
        <input type="checkbox" name="remember-me">自动登录
        <button class="btn btn-lg btn-primary btn-block" type="button" onclick="doLogin();">登录</button>
      </form>
    </div>
  </body>
</html>